// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
//
// $Id: dom.hpp 216 2008-09-03 08:13:29Z heavyzheng $
//

#ifndef ZZHENG_XML_DOM_HPP_20080717__
#define ZZHENG_XML_DOM_HPP_20080717__

#include <zzheng/xml/config.hpp>
#include <zzheng/xml/dom/exception.hpp>
#include <zzheng/xml/dom/types.hpp>
#include <zzheng/xml/dom/basic_node_ptr.hpp>
#include <zzheng/xml/dom/basic_node_iterator.hpp>
#include <zzheng/xml/dom/node_proxy.hpp>

//
// underlying XML library includes and namespace alias...
//

// Checks the conditional compilation macros. By default, use libxml2.
#if !defined(ZZHENG_XML_USES_LIBXML2) \
 && !defined(ZZHENG_XML_USES_XERCES)  \
 && !defined(ZZHENG_XML_USES_MSXML)   \
 && !defined(ZZHENG_XML_USES_CUSTOMIZED_LIB)
#  define ZZHENG_XML_USES_LIBXML2
#endif


#if defined(ZZHENG_XML_HAS_LIBXML2) || defined(ZZHENG_XML_USES_LIBXML2)
#  include <zzheng/xml/dom/libxml2.hpp>
#endif // ZZHENG_XML_HAS_LIBXML2 || ZZHENG_XML_USES_LIBXML2

#if defined(ZZHENG_XML_HAS_XERCES) || defined(ZZHENG_XML_USES_XERCES)
#  include <zzheng/xml/dom/xerces.hpp>
#endif // ZZHENG_XML_HAS_XERCES || ZZHENG_XML_USES_XERCES

#if defined(ZZHENG_XML_HAS_MSXML) || defined(ZZHENG_XML_USES_MSXML)
#  include <zzheng/xml/dom/msxml.hpp>
#endif // ZZHENG_XML_HAS_MSXML || ZZHENG_XML_USES_MSXML


#if defined(ZZHENG_XML_USES_LIBXML2)
#  define ZZHENG_XML_IMPL_NS  libxml2_
#elif defined(ZZHENG_XML_USES_XERCES)
#  define ZZHENG_XML_IMPL_NS  xerces_
#elif defined(ZZHENG_XML_USES_MSXML)
#  define ZZHENG_XML_IMPL_NS  msxml_
#endif


namespace zzheng {
namespace xml {
namespace dom {

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // DOM classes
    //

    typedef ZZHENG_XML_IMPL_NS::parser           parser;
    typedef ZZHENG_XML_IMPL_NS::document         document;
    typedef ZZHENG_XML_IMPL_NS::node             node;
    typedef ZZHENG_XML_IMPL_NS::attribute        attribute;
    typedef ZZHENG_XML_IMPL_NS::child_node       child_node;
    typedef ZZHENG_XML_IMPL_NS::element          element;
    typedef ZZHENG_XML_IMPL_NS::text             text;
    typedef ZZHENG_XML_IMPL_NS::comment          comment;
    typedef ZZHENG_XML_IMPL_NS::child_node_list  child_node_list;
    typedef ZZHENG_XML_IMPL_NS::attribute_map    attribute_map;

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // XPath classes
    //

    typedef ZZHENG_XML_IMPL_NS::xpath        xpath;
    typedef ZZHENG_XML_IMPL_NS::xpath_result xpath_result;
    typedef ZZHENG_XML_IMPL_NS::node_set     node_set;

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // pointer typedefs
    //

    typedef basic_node_ptr<node>            node_ptr;
    typedef basic_node_ptr<attribute>       attribute_ptr;
    typedef basic_node_ptr<element>         element_ptr;
    typedef basic_node_ptr<text>            text_ptr;
    typedef basic_node_ptr<comment>         comment_ptr;

    typedef basic_node_ptr<const node>      const_node_ptr;
    typedef basic_node_ptr<const attribute> const_attribute_ptr;
    typedef basic_node_ptr<const element>   const_element_ptr;
    typedef basic_node_ptr<const text>      const_text_ptr;
    typedef basic_node_ptr<const comment>   const_comment_ptr;

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // iterators
    //

    typedef basic_node_iterator<child_node>        child_iterator;
    typedef basic_node_iterator<const child_node>  const_child_iterator;
    typedef basic_node_iterator<attribute>         attribute_iterator;
    typedef basic_node_iterator<const attribute>   const_attribute_iterator;


} // namespace zzheng::xml::dom
} // namespace zzheng::xml
} // namespace zzheng


#undef ZZHENG_XML_IMPL_NS

#endif // ZZHENG_XML_DOM_HPP_20080717__



